set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode='nonstrict';
set hive.exec.max.dynamic.partitions=400;
set hive.exec.max.dynamic.partitions.pernode=400;

insert overwrite table ai_group.ai_route_city_effective
select
     in_from_city_code
    ,in_from_city_desc
    ,out_to_city_code
    ,out_to_city_desc
    ,total_days_use
    ,total_time_use
    ,total_days_t
    ,dt
from jms_dm.dm_fastest_route_area_effective
where dt = '{{ execution_date | cst_ds }}'
and is_main_city = 1
distribute by pmod(hash(rand()),1);


